<template>
    <div>
      <div>
        <header>
            <el-row type="flex" class="row-bg" justify="space-between">
              <router-link to="/user">
                <el-col :span="6">
                  <div class="grid-content bg-purple">
                      <span class="iconfont">&#xe609;</span>
                  </div>
                </el-col>
              </router-link>
              <div style="margin-right: 40.3%;color: #fff; font-size: 20px;">评价管理</div>
            </el-row>
        </header>
        <div style="height: 40.8px"></div>
      </div>
      <el-tabs v-model="activeName" :stretch="true">
        <el-tab-pane label="待评价" name="first">
          <div v-for="item in toappraise" :key="item.activityId">
            <div class="to-appraise">
              <el-avatar shape="square" :size="65" :fit="fits" :src="item.activityImg"></el-avatar>
              <div style="width: 225px;">
                <div class="activityname">
                  {{item.activityName}}
                </div>
                <div class="activitynum">
                  {{'参与了'+item.joinNumber+'人'}}
                </div>
              </div>
              <button class="appraisebutton">
                评价
              </button>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="我的评价" name="second">
          <div class="appraise-all" v-for="item in Info" :key="item.userId">
            <div class="appraise-avatar">
              <el-avatar shape="square" :size="30" :fit="fits" :src="item.userAvatar"></el-avatar>
            </div>
            <div class="appraise-show">
              <div class="name-level">
                <div class="appraise-nickname">
                  {{item.userName}}
                </div>
                <div class="level">
                  {{'评价等级：'+ item.appraiseLevel+'!'}}
                </div>
              </div>
              <div class="appraise-content">
                {{item.userContent}}
              </div>
              <div class="appraise-time">
                {{item.appraiseTime}}
              </div>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    name: 'Appraise',
    props: {
      userId: String
    },
    data() {
        return {
            fits: 'contain',
            activeName: 'first',
            toappraise: [],
            Info: []
        }
    },
    methods: {
      getHomeInfo () {
            axios.get('/static/mock/appraiseInfo.json')
                .then(this.getHomeInfoSucc)
        },
      getHomeInfoSucc (res) {
            res = res.data
            if (res.ret && res.data) {
                const data = res.data
                this.toappraise = data.toappraise
                this.Info = data.Info
            }else {
                alert('数据获取失败')
            }
            console.log(res)
        }
    },
    mounted () {
      this.getHomeInfo()
    }
}
</script>

<style scoped>
  header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    line-height: 2.5rem;
    background: #67C23A;
    text-align: center;
    }
  .iconfont {
      font-size: 1.6rem;
      color: #fff;
      margin-left: .4rem;
    }
  .appraise-all {
    display: flex;
    padding: 5px 0 0 0;
  }
  .to-appraise {
    display: flex;
    margin-left: 25px;
    border-bottom: 1px solid #eee;
    padding: 15px 0 15px 0;
  }
  .activityname {
    line-height: 32.5px;
    padding: 0 0 0 15px;
    font-size: 13px;
  }
  .activitynum {
    line-height: 32.5px;
    padding: 0 0 0 15px;
    font-size: 13px;
  }
  .appraisebutton {
    /*margin-left: 120px;*/
    background-color: #F2F53E;
    width: 50px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid white;
  }
  .appraise-avatar {
    padding: 0 0 0 10px;
  }
  .appraise-show {
    padding: 0 0 0 15px;
    border-bottom: 1px solid #eee;
    width: 100%;
  }
  .appraise-nickname {
    font-size: 12px;
    color: #C0C4CC;
  }
  .appraise-content {
    font-size: 13.5px;
    margin-top: 4px;
    margin-bottom: 4px;
    padding-top: 5px;
  }
  .appraise-time {
    font-size: 12px;
    color: #C0C4CC;
    margin-bottom: 5px;
    padding-top: 5px;
  }
  .name-level {
    display: flex;
    align-items: center;
  }
  .level {
    float: right;
    margin-left: 30%;
  }
</style>